function initAttendance() {
    $('body').on('click','.checkMonth', function () {
        var type = $(this).attr('data-type');
        var month = $(this).attr('data-month');
        var year = $(this).attr('data-year');
        var currYear = $('#currYear').val();
        var currMonth = $('#currMonth').val();
        if (type == 1) {
            //往前翻
            if (month == '01') {
                month = 12;
                year -= 1;
            } else {
                month -= 1;
            }
        } else {
            //往后翻
            if (month == currMonth && (year == currYear)) {
                layer.msg('已经是最后一页');
                return;
            } else {
                if (month == '12') {
                    year = parseInt(year) + 1;
                    month = 1;
                } else {
                    month = parseInt(month) + 1;
                }
            }
        }

        var url = $('#url').val() + '?month=' + month + '&year=' + year;
        $.get(url, function (res) {
            console.log(res);
            var html = '<h2>我的考勤</h2><div class="select_time"><div class="time_left">';
            html += '<a class="pointer checkMonth" data-month="'+res.month+'" data-type="1" data-year='+res.year+'><img src="/Public/Index/img/arrow_left.svg" /></a></div>';
            html += '<h3>'+res.show+'</h3>';
            html += '<div class="time_right"><a class="pointer checkMonth" data-month="'+res.month+'" data-type="2" data-year='+res.year+'><img src="/Public/Index/img/arrow_right.svg" /></a></div></div>';
            html += '<div class="kaoqin"><ul class="kaoqin_list">';
            html += '<li><a href="/index.php/Index/Attendance/lists/type/1/month/'+res.month+'/year/'+res.year+'"><span>'+res.attDaysCount+'</span><br/>出勤</a></li>';
            html += '<li><a href="/index.php/Index/Attendance/lists/type/2/month/'+res.month+'/year/'+res.year+'"><span>'+res.lateDaysCount+'</span><br/>迟到</a></li>';
            html += '<li><a href="/index.php/Index/Attendance/lists/type/3/month/'+res.month+'/year/'+res.year+'"><span>'+res.earlyCount+'</span><br/>早退</a></li>';
            html += '<li><a href="/index.php/Index/Attendance/lists/type/4/month/'+res.month+'/year/'+res.year+'"><span>'+res.loseDaysCount+'</span><br/>缺卡</a></li></ul>';
            html += '<ul class="kaoqin_list">';
            html += '<li><a href="/index.php/Index/Attendance/attLists/type/5/month/'+res.month+'/year/'+res.year+'"><span>'+res.leaveCount+'</span><br/>请假</a></li>';
            html += '<li><a href="/index.php/Index/Attendance/attLists/type/6/month/'+res.month+'/year/'+res.year+'"><span>'+res.evectionCount+'</span><br/>出差</a></li>';
            html += '<li><a href="/index.php/Index/Attendance/attLists/type/7/month/'+res.month+'/year/'+res.year+'"><span>'+res.outCount+'</span><br/>外出</a></li>';
            html += '<li><a href="#"><span>'+res.yearLeave+'</span><br/>剩余年假</a></li></ul></div>';
            
            $('.my_attendance').html(html);
        })
    })

}

